using System.Collections.Generic;

namespace data.contracts
{
    public class Board
    {
        private readonly IList<Wire> wires;
        private readonly IList<string> usings;
        private readonly IList<string> externals;
        private string @interface;
        private readonly IList<Dependency> dependencies;

        public Board(string name, string @namespace) {
            Name = name;
            Namespace = @namespace;
            wires = new List<Wire>();
            usings = new List<string>();
            externals = new List<string>();
            dependencies = new List<Dependency>();
        }

        public string Name { get; private set; }

        public string Namespace { get; private set; }

        public void Add(Wire wire) {
            wires.Add(wire);
        }

        public IEnumerable<Wire> Wires {
            get { return wires; }
        }

        public void ReplaceWires(IEnumerable<Wire> wires) {
            this.wires.Clear();
            foreach (var wire in wires) {
                Add(wire);
            }
        }

        public void SetInterface(string @interface) {
            this.@interface = @interface;
        }

        public string Interface {
            get { return @interface; }
        }

        public void AddUsing(string @using) {
            usings.Add(@using);
        }

        public IEnumerable<string> Usings {
            get { return usings; }
        }

        public void AddExternal(string name) {
            externals.Add(name);
        }

        public IEnumerable<string> Externals {
            get { return externals; }
        }

        public void AddDependency(Dependency dependency) {
            dependencies.Add(dependency);
        }

        public IEnumerable<Dependency> Dependencies {
            get { return dependencies; }
        }
    }
}